Skip to content

Conversation

@herin049
Copy link
Contributor

@herin049 herin049 commented Dec 1, 2025

Description

This PR adds the ability to capture custom client headers in the opentelemetry-instrumentation-aiohttp-client library. These changes implement #3962 for the aiohttp HTTP client library.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Basic set of unit tests have been added.

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@JWinermaSplunk
Copy link

nitpick: might change get_custom_header_attributes to get_sanatized_custom_header_attributes, but otherwise looks good to me!

@herin049 herin049 force-pushed the feature/aiohttp-client-custom-headers branch from 9870a3d to 99f9f39 Compare December 5, 2025 14:57
@herin049
Copy link
Contributor Author

herin049 commented Dec 7, 2025

nitpick: might change get_custom_header_attributes to get_sanatized_custom_header_attributes, but otherwise looks good to me!

I was considering adding even more context to this function name e.g. making it get_sanitized_custom_header_attributes or get_normalized_custom_header_attributes, but I personally find the shorter version a bit easier to read at a glance, plus documentation wise, I think the doc-string in the PR documents the behavior of the function pretty well.

…rc/opentelemetry/instrumentation/aiohttp_client/__init__.py
…rc/opentelemetry/instrumentation/aiohttp_client/__init__.py
@xrmx xrmx enabled auto-merge (squash) December 22, 2025 13:36
@xrmx xrmx merged commit a986d25 into open-telemetry:main Dec 22, 2025
663 checks passed
@github-project-automation github-project-automation bot moved this from Ready for review to Done in @xrmx's Python PR digest Dec 22, 2025
herin049 added a commit to herin049/opentelemetry-python-contrib that referenced this pull request Dec 22, 2025
…custom headers (open-telemetry#3988)

* opentelemetry-instrumentation-aiohttp-client: add support to capture custom headers

* update unit tests

* update CHANGELOG.md

* add 'get_custom_header_attributes' helper to opentelemetry-util-http

* fix formatting issues

* fix CHANGELOG.md format

* Update instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py

* Update instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/__init__.py

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants